#ifndef STARALGORITHM_H
#define STARALGORITHM_H
#include <vector>
#include <math.h>
//#include <Windows.h>

#include "node.h"
#include "maze.h"
#include "nodegraphics.h"

typedef std::vector<Node*> ListNode;

class StarAlgorithm: public QObject
{
    Q_OBJECT
public:
    StarAlgorithm(const Maze &M_);
    ~StarAlgorithm();
    void SetParams(const Maze &M_);
    Node* Start();
    void AddNode(Node ToAdd, Node *Parent);
    static Node * find(ListNode::iterator Begin,ListNode::iterator End, Node n);
    void expandNode(Node *n);
    Maze M;
    void updateGraph();
    bool resolved;
    void showHideLists();
    double pesoVertical,pesoHorizontal,pesoDiagonal;
    static Node *find(int row, int col);
    static ListNode Close;
    static ListNode Open;

public slots:
    void setPesoHorizontal(double p);
    void setPesoVertical(double p);
    void setPesoDiagonal(double p);
    int printParc(int row, int col);

private:
    void printOpen();
    void printClose();
    Node *Inicial,*Final;
    void clearNodes();
    bool showLists;
    void printResp(Node *n);

};

#endif // STARALGORITHM_H
